<?php
	include("../Action/config.php");
	
	$json = urldecode(file_get_contents("php://input"));
	$arrayJson = json_decode($json,true);
	
	$child_num = $arrayJson['child_num'];		
	$extra_time = $arrayJson['extra_time'];
	$limit_time = $arrayJson['limit_time'];
	
	//find the parent that is matched with the phone_num 
	$sql = "UPDATE CHILD SET extra_time = '$extra_time' 
	WHERE child_num = '$child_num'";
	$result = mysql_query($sql);
	
	$sql = "UPDATE CHILD SET limit_time = '$limit_time' 
	WHERE child_num = '$child_num'";
	$result = mysql_query($sql);
	
	if($result == '1'){ // success to insert data into DB then return child_id
		echo "success"; 
	}else{ // fail to insert data into DB
		echo "fail";
	}
?>